package com.example.test.springbootConfig;

import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;

/**
 * @Component 保证 WechatUtil被容器自动实例化
 **/
@Component
public class WechatUtil {
    private WechatSetting wechatSetting;
    public static String token;
    public static String appid;
    public static Person[] persons;

    public WechatUtil(WechatSetting wechatSetting) {
        this.wechatSetting = wechatSetting;
    }

    @PostConstruct
    public void init() {
        token = wechatSetting.token;
        appid = wechatSetting.appid;
        persons = wechatSetting.persons;
    }

    public static String getToken() {
        return token;
    }

    public static String getAppid() {
        return appid;
    }

    public static Person[] getPersons() {
        return persons;
    }

}
